package com.protocols.sctp.m3ua.sccp.tcap.camel;

import java.io.Serializable;

import com.protocols.BCDNumber;
import com.protocols.OctaveInteger;
import com.protocols.ProtoOperations;
import com.protocols.ProtocolStackException;
import com.protocols.sctp.m3ua.sccp.tcap.TcapBegin;
import com.protocols.sctp.m3ua.sccp.tcap.TcapConstructor;
import com.protocols.sctp.m3ua.sccp.tcap.TcapPrimitiveUnitByteArray;
import com.protocols.sctp.m3ua.sccp.tcap.TcapPrimitiveUnitNumber;

public class CamelApplyChargingReport extends CamelInvoke implements Serializable{
	
	private TcapConstructor ApplyChargingReport = new TcapConstructor(0x04);
	private TcapConstructor CamelCallResult = new TcapConstructor(0xa0);
	private TcapConstructor LegIDContainer = new TcapConstructor(0xa0);
	private TcapPrimitiveUnitNumber ReceivingSideID = new TcapPrimitiveUnitNumber(0x81);
	private TcapConstructor TimeInformationContainer = new TcapConstructor(0xa1);
	private TcapPrimitiveUnitNumber TimeIfNoTariffSwitch = new TcapPrimitiveUnitNumber(0x80);
	private TcapConstructor TimeIfTariffSwitch = new TcapConstructor(0xa1);
	private TcapPrimitiveUnitNumber TimeSinceTariffSwitch = new TcapPrimitiveUnitNumber(0x80);
	private TcapPrimitiveUnitNumber TariffSwitchInterval = new TcapPrimitiveUnitNumber(0x81);
	private TcapPrimitiveUnitNumber LegActive = new TcapPrimitiveUnitNumber(0x82);
	
	private TcapPrimitiveUnitByteArray Extensions = new TcapPrimitiveUnitByteArray(0xa3);
	
	public CamelApplyChargingReport() {
		super();	
		super.Invoke.addElement(ApplyChargingReport);
		ApplyChargingReport.addElement(CamelCallResult);
		CamelCallResult.addElement(LegIDContainer);
		LegIDContainer.addElement(ReceivingSideID);
		CamelCallResult.addElement(TimeInformationContainer);
		TimeInformationContainer.addElement(TimeIfNoTariffSwitch);
		TimeInformationContainer.addElement(TimeIfTariffSwitch);
		TimeIfTariffSwitch.addElement(TimeSinceTariffSwitch);
		TimeIfTariffSwitch.addElement(TariffSwitchInterval);
		CamelCallResult.addElement(LegActive);		
		
		super.Invoke.addElement(Extensions);
		setOpCode(36,true);	// Apply Charging Report
		
	}
		
	
	
	public TcapConstructor getRootComponent(){
		return Invoke;
	}
	
	
	public void setPartyToCharge(int legid){
		
			ReceivingSideID.setTagValue(legid);
			
		
	}
	
	
	public void getPartyToCharge(){
		ReceivingSideID.getTagValue();			
		
		
	}



	public Boolean getLegActive() {
		return (LegActive.getTagValue()==1);
	}



	public void setLegActive(Boolean legActive) {
		LegActive.setTagValue(legActive?1:0);
	}



	public long getTimeIfNoTariffSwitch() {
		
		return TimeIfNoTariffSwitch.getTagValue();
	}



	public void setTimeIfNoTariffSwitch(long timeIfNoTariffSwitch) {
		TimeIfNoTariffSwitch.setTagValue(timeIfNoTariffSwitch);
		TimeSinceTariffSwitch.setVisible(false);
		TariffSwitchInterval.setVisible(false);
	}



	public long getTimeSinceTariffSwitch() {
		return TimeSinceTariffSwitch.getTagValue();
	}



	public void setTimeSinceTariffSwitch(long timeSinceTariffSwitch) {
		TimeSinceTariffSwitch.setTagValue( timeSinceTariffSwitch);
		TimeIfNoTariffSwitch.setVisible(false);
	}



	public long getTariffSwitchInterval() {
		return TariffSwitchInterval.getTagValue();
	}



	public void setTariffSwitchInterval(long tariffSwitchInterval) {
		TariffSwitchInterval.setTagValue( tariffSwitchInterval);
		TimeIfNoTariffSwitch.setVisible(false);
	}



	
}
